Hi, this is a sample book. Enjoy!

Interactive code (ICode) examples

Simplest Example

Example with program from scratch and no output checking.

Coding activity
Free writing

Write any program you want, and run it to see its output.

Starter code and output checking

Example with started code that students need to complete. We check the program’s output.

Coding activity
Hello world

Finish the program below so that it outputs the following to stdout: Hello World!

Checking file output

A test can also check the contents of files created by the interactive code.

Coding activity
File output

Finish the program so that it outputs the text Hello World, both to stdout and the file message.txt.

Complex example

By hiding some of the input files from the user, you can design complex test cases without necessarily exposing this code as part of the exercise.

It is also possible to make input files readonly, or restrict editing to certain lines.

Coding activity
API completion

A simple list API is defined in list.h. Finish the incomplete function in list.c to complete the exercise.

Multiple Choice Question examples

Simple Example

Write any MCQ you want, select your answer(s) and click on run to see the answer.

MCQ activity
Circumference

Let’s explore the mathematical world of circles!

What is the formula for the circumference of a circle?

We covered this in Section 1.

A.
B.
A.

The radius only refers to the distance from the center to any edge of the circle, not the circumference itself.

B.

That’s right! The circumference of a circle is given by 2π2.

This is a simple example where only one of the choices is correct. Let us define some of the elements of this configuration. Firstly, we have the type. The type key specifies the type of the question; one indicates that there is only one correct answer.

Notice the use of $ signs in the example above. This is the syntax used in Markdown to style mathematical expressions with the appropriate format and symbols.

Randomizing answer choices

One can specify whether the choices to each question are randomized using the random key. Set random: true to enable randomization. This is an optional key; its default value is false. Note that the randomization is performed once statically when the HTML book is generated.

MCQ activity
Programming languages

Which of the following is not a programming language?

A.
B.
C.
D.
A.

Did you know that the first version of Javascript had been created in only 10 days back in 1995, as a way to make web pages dynamic!

B.

Java is one of the most popular object-oriented programming languages, developed by Sun Microsystems in 1995.

C.

Python is a progamming language created by Guido Van Rossum.

D.

HTML is a markup language for displaying documents in a web browser. It was invented at CERN and released in 1993.

One-to-many MCQs

With the many: true key, one can specify multiple correct answers to a question.

MCQ activity
Data Types in C

Which of the following are native C data types?

A.
B.
C.
D.
A.

Yes, int is a type for holding integers.

B.

let is a construct for declaring variables in Javascript.

C.

var is a construct for declaring variables in Javascript.

D.

Yes, char is a type for holding characters.

Fill-in-the-blanks examples

Simple Example

Write any FIB you want, fill in the blank and see its result.

FIB activity
Bones

Fill in the blanks below about the human body.

How many bones are there in an adult’s body?

There are

1

bones in an adult’s body.

1

The skeleton of an adult consists of 206 bones. Fun fact: the average weight of a woman’s skeleton is 10 kg while the average weight of a man’s skeleton is 12kg.

This is a straightforward example with just one blank. Let’s clarify some of the elements of this setup.

“Text” refers to the entire paragraph that will be displayed in the card body, which may include one or more blanks. “|blank|” means blank in the text. Answers contain the answer of each blank, along with the corresponding feedback.

Multiple Blanks Example

If you want to incorporate additional blanks into the text, you can simply insert more “|blank|” placeholders within the paragraph. Additionally, make sure to include corresponding elements in the answers section to accommodate the answers and responses for each additional blank.

FIB activity
Program

Fill in the blanks below about variable declaration in Python.

Complete the following line of a Python program so that it will declare an integer variable age with an initial value of 5.

1

age =

2

;

1

Remember that Java uses just the first three letters of the word “integer” to define an integral type.

2

Use 5 as the initial value of the variable.

Case Sensitive Example

The casing property is applied to this question and applies to all blanks.

FIB activity
Python Keyword Trivia

Fill in the blanks with Python keywords.

In Python, to define a function, you use the

1

keyword, and to indicate the end of a loop or conditional block, you use the

2

keyword.

1

In Python, you define a function using the def keyword.

2

To indicate the end of a loop or conditional block in Python, you use the break keyword.

Parsons examples

Simple Example

Write any parsons exercise you want, drag and drop fragments and see its result.

Parsons activity
Example 1

Create a proof of the theorem: if n is an even number, then n ≡ 0 mod 2.

Drag items from here...
...and drop them here (click to remove)

So n = 2m + 0.

Thus n ≡ 0 mod 2.

Suppose n is even.

Then there exists an m so that n = 2m.

Redundant fragment

This is a simple example without any additional functions. Let’s clarify certain aspects of this configuration.

Label and Random Example

You can activate the ‘label’ option, resulting in the creation of a numbered label on the left side of each fragment.

Similarly, you have the option to enable ‘random’, which will introduce randomness to the order of the fragments. Note that the randomization is performed once statically when the HTML book is generated.

Parsons activity
Example 2

Create a proof of the theorem: if n is an even number, then n ≡ 0 mod 2.

Drag items from here...
...and drop them here (click to remove)
0

Thus n ≡ 0 mod 2.

1

So n = 2m + 0.

2

Suppose n is even.

3

Then there exists an m so that n = 2m.

4

Redundant fragment

OR-group Examples

To group fragments together as part of the same “or-group,” you can assign an ‘gid’ within each fragment. Fragments with the same ‘gid’ will be clustered together, with only one correct fragment within that cluster.

Parsons activity
Example 3

Create a proof of the theorem: if n is an even number, then n ≡ 0 mod 2.

Drag items from here...
...and drop them here (click to remove)

Suppose n is even.

or{

Then there exists an m so that n = 2m.

Then there exists an m so that n = 2m + 1.

Then n is a prime number.

or{

So n = 2m + 0.

So n = 2m + 1.

Thus n ≡ 0 mod 2.

Redundant block

Matching examples

Simple Example

Matching activity
Match College Year to Term

Match the term to each college year.

Drag items from here...
...and drop them here (click to remove)
1

Freshman

2

Sophomore

3

Junior

4

Senior

First Year

Second Year

Third Year

Fourth Year

1

“Freshman” is used to refer to a first-year student

2

“Sophomore” is used to refer to a second-year student

3

“Junior” is used to refer to a third-year student

4

“Senior” is a term used to refer to a fourth-year student

Multiple Choices to Answers Example

Matching activity
Match Food Item

Match the food items to it’s respective food category.

Drag items from here...
...and drop them here (click to remove)
1

Apple

2

Tomato

3

Carrot

Fruit

Vegetable

1

Apples are a fruit, more specifically an accessory fruit!

2

Tomatoes are thought to be vegetables because of their uses in cooking, but they are actually fruits!

3

Carrots are root vegetables!

Horizontal Parsons examples

Simple Example

Write any horizontal parsons exercise you want, drag and drop fragments and see its result.

Horizontal parsons activity
SQL

Rearrange the fragments to form a valid SQL statement

Drag items from here...

test

SELECT

*

FROM

Distractor

...and drop them here (click to remove)

Label and Random Example

You can activate the ‘label’ option, resulting in the creation of a numbered label on the left side of each fragment.

Similarly, you have the option to enable ‘random’, which will introduce randomness to the order of the fragments. Note that the randomization is performed once statically when the HTML book is generated.

Horizontal parsons activity
Sentence

Reorder the following words to make a sentence.

Drag items from here...
0

over

1

fox

2

dog

3

jumped

4

the

5

The

6

quick

7

brown

8

lazy

...and drop them here (click to remove)